/**
 * 生成UUID
 * */
export function uuid(): string {
    function S4() {
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
    }
    return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
/**
 * 获取浏览器ID
 * */
export function getClientId(): String {
    const clientId = localStorage.getItem('client-id')
    if (!clientId) {
        const newClientId = uuid()
        localStorage.setItem('client-id', newClientId)
        return newClientId
    }
    return clientId
}
/**
 * 宣告无障碍状态消息
 * @param text 消息内容
 * */
export function announceStatusMessage(text: string) {
    const pStatus = document.querySelector('p[role=status]')
    if (pStatus)
        pStatus.textContent = text
    setTimeout(() => {
        if (pStatus)
            pStatus.textContent = ''
    }, 1000)

}